<?php
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'credit1';
$return=array();
$tabs=array(
	array('op'=>'credit1','title'=>'积分排行榜设置'),
	array('op'=>'money','title'=>'消费排行榜设置'),
);
if($_RQ['op']=='credit1'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$data=array_fields(array('credit1_url','credit1_switch','credit1_sum'),$postdata);
		$data['credit1_url']=custom_url('jy_weishop/member.rank/',true);
		$data['money_url']=custom_url('jy_weishop/member.rank/order_rank/',true);
		$this->plugin_setting('credit1',$data);
		exi('设置成功');
	}
	$return['item']=$this->plugin_setting('credit1');
	$return['item']['credit1_url']=custom_url('jy_weishop/member.rank/',true);
	$htmls=array(
		'type'=>'edit',
		'desc'=>'积分排行榜设置',
		'tabs'=>$tabs,
		'edit'=>array(
		    array('type'=>'string','title'=>'直接链接','name'=>'credit1_url','help'=>'','read'=>true),
			 array('name'=>'credit1_url','title'=>'二维码','type'=>'ewm'),
			array('type'=>'switch','title'=>'积分排行榜开关','name'=>'credit1_switch'),
			array('type'=>'string','title'=>'积分榜显示数量','name'=>'credit1_sum','help'=>'如果不填写，默认显示前50名'),
		),
	);
	$return['htmls']=$htmls;
	exi($return);
}
if($_RQ['op']=='money'){
	if($_RQ['postdata']){
		$postdata=get_postdata();
		$data=array_fields(array('money_url','money_switch','money_sum'),$postdata);
		$this->plugin_setting('money',$data);
		exi('设置成功');
	}
	$return['item']=$this->plugin_setting('money');
	$return['item']['money_url']=custom_url('jy_weishop/member.rank/order_rank/',true);
	$htmls=array(
		'type'=>'edit',
		'desc'=>'参数设置',
		'tabs'=>$tabs,
		'edit'=>array(
			 array('type'=>'string','title'=>'直接链接','name'=>'money_url','help'=>'','read'=>true),
			 array('name'=>'money_url','title'=>'二维码','type'=>'ewm'),
			array('type'=>'switch','title'=>'消费排行榜开关','name'=>'money_switch'),
			array('type'=>'string','title'=>'消费榜显示数量','name'=>'money_sum','help'=>'如果不填写，默认显示前50名'),
		),
	);
	$return['htmls']=$htmls;
	exi($return);
}